package com.hduong.springcloud.controller;

import com.hduong.springcloud.domain.CommonResult;
import com.hduong.springcloud.service.StorageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.math.BigDecimal;

/**
 * <h3>spring-cloud-demo-parent</h3>
 * <p>storageController</p>
 *
 * @author : hduong
 * @version : 1.0
 * @date : 2020-03-23 10:02
 **/
@RestController
@RequestMapping("/storage")
public class StorageController {

    @Autowired
    private StorageService storageService;

    @GetMapping("/decrease")
    public CommonResult decrease(@RequestParam("productId") Long productId, @RequestParam("count") Integer count){
        storageService.decrease(productId, count);
        return new  CommonResult("扣减库存成功！",200);
    }
}
